import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString, IsObject, ValidateNested } from 'class-validator';
import { Type } from 'class-transformer';
import { DeviceMetaRequestDto } from './device-meta.dto';

export class CreateDeviceDto {
  @ApiProperty({
    description: 'Device serial number (must be unique)',
    example: 'SN12345678',
  })
  @IsString()
  @IsNotEmpty()
  serialNumber: string;

  @ApiProperty({
    description: 'Device metadata (JSON object with additional device information)',
    type: DeviceMetaRequestDto,
  })
  @ValidateNested()
  @Type(() => DeviceMetaRequestDto)
  metadata: DeviceMetaRequestDto;
}
